/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package util;

import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;

/**
 *
 * @author Paulo Ilenga
 */
public class SessionPhaseListener implements PhaseListener
{

    @Override
    public PhaseId getPhaseId()
    {
        return PhaseId.RENDER_RESPONSE;
    }

    @Override
    public void afterPhase(PhaseEvent event)
    {
    }

    @Override
    public void beforePhase(PhaseEvent event)
    {
        // we need to ask for the session early
        FacesContext.getCurrentInstance().getExternalContext().getSession(true);

    }
}
